package systemlog

import (
	"go-caipu/pkg/services/dto"
)

type GetSysOperaLogPageCommand struct {
	dto.Pagination `search:"-"`
	Status         string `form:"status"  search:"type:exact;column:status_code;table:sys_opera_log" comment:"状态"`
	BeginTime      string `form:"beginTime" search:"type:gte;column:created_at;table:sys_opera_log" comment:"创建时间"`
	EndTime        string `form:"endTime" search:"type:lte;column:created_at;table:sys_opera_log" comment:"创建时间"`
	SysOperaLogOrder
}
type SysOperaLogOrder struct {
	CreatedAtOrder string `search:"type:order;column:created_at;table:sys_opera_log" form:"createdAtOrder"`
}

func (m *GetSysOperaLogPageCommand) GetNeedSearch() interface{} {
	return *m
}

type SysOperaLog struct {
	Id              int64  `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码"`
	Module          string `json:"module" gorm:"type:varchar(128);comment:操作系统"`
	Os              string `json:"os" gorm:"type:varchar(128);comment:操作系统"`
	Description     string `json:"description" gorm:"type:varchar(128);comment:操作系统"`
	Address         string `json:"address" gorm:"type:varchar(300);comment:地址"`
	Browser         string `json:"browser" gorm:"type:varchar(128);comment:浏览器"`
	Ip              string `json:"ip" gorm:"type:varchar(64);comment:IP"`
	Method          string `json:"method" gorm:"type:varchar(128);comment:请求方式"`
	RequestBody     string `json:"requestBody" gorm:"type:varchar(3000);comment:请求体"`
	RequestHeaders  string `json:"requestHeaders" gorm:"type:varchar(900);comment:请求头"`
	RequestUrl      string `json:"requestUrl" gorm:"type:varchar(200);comment:请求url"`
	ResponseBody    string `json:"responseBody" gorm:"type:varchar(3000);comment:响应体"`
	ResponseHeaders string `json:"responseHeaders" gorm:"type:varchar(900);comment:响应头"`
	StatusCode      int    `json:"status" gorm:"type:int;comment:状态码"`
	Remark          string `json:"remark" gorm:"type:varchar(600);comment:备注"`
	TraceId         string `json:"traceId" gorm:"type:varchar(64);comment:trace ID"`
	TimeTaken       int64  `json:"timeTaken" gorm:"type:int;comment:耗时"`
	CreateUser      string `json:"createUserString" gorm:"type:varchar(100);comment:操作"`
	CreateBy        int64  `json:"createBy" gorm:"index;comment:创建者"`
	CreatedAt       string `json:"createTime" gorm:"comment:创建时间"`
	FullPath        string `json:"-" gorm:"-"`
}
type GetSysOperaLogCommand struct {
	ID int64 `uri:"id"`
}
